package com.qf.feign;

import com.qf.feign.fallback.GoodsFallback;
import com.qf.feign.fallback.MyFallbackFactory;
import com.qf.pojo.Goods;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "QF-GOODS")
public interface GoodsFeign {
    @RequestMapping("/query/{id}")
    public String query(@PathVariable("id") Integer id);
    @GetMapping("/goods/findById")
    //Get请求用这个注解@RequestParam传递多个参数使用，必须要加否则接收不到数据，也可能报错
    public Goods findById(@RequestParam("id") Integer id);
    @GetMapping("/goods/{id}")
    //传递单个参数时，推荐使用@PathVariable;
    public String findDetails(@PathVariable("id") Integer id);
    @PostMapping("/goods/save")
    //传递对象时用json的方式添加@requestBody注解
    public String findGoods(@RequestBody Goods goods);
    @GetMapping("/goods/getGoods")
    public String getGoods(@RequestParam Integer id,@RequestParam String name);
}
